<?php
namespace Admin\Controller;
use Common\Controller\AdminBaseController;
/**
 * 后台首页控制器
 */
class IndexController extends AdminBaseController{
	/**
	 * 首页
	 */
	public function index(){

		if(isMobile()){
			$this->redirect('Home/Index/phone_msg');
		}else{

			// 分配菜单数据
			$nav_data=D('AdminNav')->getTreeData('level','order_number,id');

			$assign=array(
				'data'=>$nav_data
			);
			$this->assign($assign);
			$this->display();
		}

	}

	/**
	 * elements
	 */
	public function elements(){

		$this->display();
	}

	/**
	 * 个人面板
	 */
	public function setting(){

		//获取邮件发送模板
		$mail_template = $this->fetch("./tpl/Admin/Index/mail_template.html");

		if(IS_POST){

			$data = D('Index')->setting($mail_template);

			$this->assign($data);

		}

		$where = array(
			"id"=>session('user.id')
		);

		$user_info = M('users')->field('qq,phone,email')->where($where)->find();


		$this->assign($user_info);
		$this->display();
	}

	/**
	 * 设置QQ号
	 */
	public function customer(){

		// 分配菜单数据
		$nav_data=D('AdminNav')->getTreeData('level','order_number,id');

		$assign=array(
			'data'=>$nav_data
		);
		$this->assign($assign);
		$this->display();
	}

}
